package com.itita.ww2.model.item;

import com.itita.ww2.model.item.enums.ItemEquipType;
import com.smartfoxserver.v2.entities.data.ISFSObject;

public class ItemEquip extends AbstractItem {
	// private static final Logger logger = LoggerFactory.getLogger(ItemEquip.class);
	private ItemEquipType equipType;

	private int lv;
	private String nextId;
	private ISFSObject compositeRes;
	private ISFSObject compositeTable;
	// 
	private boolean used; // 是否已在使用中

	public ItemEquip(String itemId, int param1, int param2, boolean useable, int effParam,
			/* @formatter:off Equipment */int lv, String nextId, ISFSObject com_res, 
						ISFSObject com_table, boolean compositable,boolean used
			/* @formatter:on */) {
		super(itemId, param1, param2, useable, effParam);
		this.equipType = ItemEquipType.idValueOf(itemId);
		this.lv = lv;
		this.nextId = nextId == null ? "" : nextId;
		this.compositeRes = com_res;
		this.compositeTable = com_table;
		this.used = used;
		this.compositable = compositable;
	}

	public boolean isUsed() {
		return used;
	}

	public void setUsed(boolean used) {
		this.used = used;
	}

	@Override
	public ISFSObject toSFSObject() {
		ISFSObject ref = super.toSFSObject();
		ref.putBool("used", this.used);
		return ref;
	}

	public ItemEquipType getEquipType() {
		return equipType;
	}

	public int getLv() {
		return lv;
	}

	public String getNextId() {
		return nextId;
	}

	public ISFSObject getCompositeRes() {
		return compositeRes;
	}

	public ISFSObject getCompositeTable() {
		return compositeTable;
	}

	@Override
	public boolean canStack() {
		return !isUsed();
	}
}
